﻿using com.uplus.common;
using com.uplus.log4net;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using WebApi.Bill.Biz;
using WebApi.Models;

namespace WebApi.Common
{
    /// <summary>
    /// 云里物里工具类
    /// </summary>
    public class YlwlStationTool
    {

        private static string storeUser = AppConfigurtaion.GetSecondSection("YlwlSetting", "storeUser");//"derui";

        private static string storePassword = AppConfigurtaion.GetSecondSection("YlwlSetting", "storePassword");//"123456";  

        //private static string storeUuid = AppConfigurtaion.GetSecondSection("YlwlSetting", "storeUuid");//"094"; 

        private static string storeUuid = "";//"094"; 

        private static string storeUuidUrl = "http://esl.ylwlesl.com:9191/V2/pub/store/query";

        private static string qrcodeUrl = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx2f3e4dde1019b63a&redirect_uri=http%3a%2f%2fuplus.uplussoft.com%2findex.html";//"http://106.14.31.223:8081/#/WxStation";  //"http://106.14.31.223:8715/#/WxStation";

        private static string wxParam = "&response_type=code&scope=snsapi_userinfo&#wechat_redirect";

        private static string updateStaUrl = "http://esl.ylwlesl.com:9191/V2/good/brush";

        private static string tokenUrl = "http://esl.ylwlesl.com:9191/V1/Login";

        private static string templateIdUrl = "http://esl.ylwlesl.com:9191/V2/pub/binding/query";

        private static string goodIdUrl = "http://esl.ylwlesl.com:9191/V2/label/query";

        private static string gatewayUrl = "http://esl.ylwlesl.com:9191/V2/gateway?storeUuid="+ storeUuid + "&page=1&size=15";

        #region UrlEncode
        public static string UrlEncode(string str)
        {
            StringBuilder sb = new StringBuilder();
            byte[] byStr = System.Text.Encoding.UTF8.GetBytes(str); //默认是System.Text.Encoding.Default.GetBytes(str)
            for (int i = 0; i < byStr.Length; i++)
            {
                sb.Append(@"%" + Convert.ToString(byStr[i], 16));
            }

            return (sb.ToString());
        }
        #endregion
    }
}
